Overview
Loop over datasource files is an agent behavior that enables agents to iterate through files in a user’s personal knowledge base (datasource), processing each file individually. When combined with appropriate tools, the agent can automatically access and process file content without requiring manual file ID specification for each file.What It Does
When this behavior is enabled, the system:- Provides file context to the agent: Passes the user’s datasource file list to the agent execution
- Automatically adds input variables: Creates
Variables.fileId,Variables.BinderID, andVariables.Pathwithout manual configuration - Automatically populates variables: Updates these variables for each file during iteration
- Enables sequential iteration: Processes each file in the datasource one at a time
- Works with compatible tools: The agent can use file retrieval tools that access the auto-populated variables
Quick Start - How Users Configure It
Supported Tools
The Loop over datasource files behavior works best with these tools, with agent builder configuration required:1. File Content Retrieval (PRIMARY/RECOMMENDED)
- Tool Type:
FileContentRetrieval - Purpose: Retrieve full file content and metadata by file ID
- API Endpoint:
/v1/DataVectorSearch/file/<fileId>/content - Parameters:
fileId(string, required): The unique identifier (GUID) of the file to retrieve
- Why it’s best: Direct file access, simple single parameter, returns complete file content
- What it returns: Full file content, metadata, source details, and other properties
2. Binder Content Retrieval
- Tool Type:
BinderContentRetrieval - Purpose: Retrieve artifact content from a document Binder
- API Endpoint:
/index-search/v1/Binder/<BinderID>/content?path=<Path> - Parameters:
BinderID(string, required): The unique identifier of the binderPath(string, required): Path to the artifact in the binder
- What it returns: The full content of the specified artifact
3. List artifacts in Binder
- Tool Type:
ListBinderArtifacts - Purpose: Get a list of all artifacts (files) at a specific path in the Binder
- API Endpoint:
/index-search/v1/Binder/<BinderID>/files?path=<Path> - Parameters:
BinderID(string, required): The unique identifier of the binderPath(string, required): Path in the binder
- What it returns: Array of file metadata (names, paths, types, etc.)
4. List folders in Binder
- Tool Type:
ListBinderFolders - Purpose: Get a list of all folders at a specific path in the Binder
- API Endpoint:
/index-search/v1/Binder/<BinderID>/folders?path=<Path> - Parameters:
BinderID(string, required): The unique identifier of the binderPath(string, required): Path in the binder
- What it returns: Array of folder names and paths
How to Use (Agent Studio Instructions)
Complete Setup Process
Follow these steps to enable file iteration in your agent:Step 1: Enable the Loop over Datasource Files Behavior
- Navigate to the Agent Studio
- Go to the Behavior section
- Click to enable “Loop over datasource files”
- Click on the Add Files in the Playground or in Catalog chat and select Look over data source files
- A configuration dialog will appear showing:
- User’s personal datasource (auto-selected)
- Datasource name (e.g., “UserPersonalFiles”)
- Total file count (e.g., “25 files”)
- Click “Use datasource” to confirm
Step 2: Input Variables Are Automatically Added ✨
This is automatic! Once the behavior is enabled, the system automatically adds the following input variables for each file iteration:| Variable | Description | Access Pattern | Example Value |
|---|---|---|---|
{{Variables.fileId}} | Current file’s unique identifier | Use in tool parameters or prompts | "a1b2c3d4-e5f6-7890-abcd-ef1234567890" |
{{Variables.BinderID}} | Current binder identifier | Use for Binder tools | "binder-12345" |
{{Variables.Path}} | Current file path in binder | Use for Binder tools | "/documents/contracts/contract.pdf" |
Step 3: Add Compatible Tools to Model or Canvas
This is required! You must manually add one or more of these tools:Option A: Add Tool to Model Step (Recommended)
- Select your Model step (AI Operation step)
- In the Tools section, click “Add Tool”
- Search for and add one of the supported tools (tools must be added to the project first):
- “File Content Retrieval” (recommended - simplest)
- “Binder Content Retrieval”
- “List artifacts in Binder”
- “List folders in Binder”
- The tools are now available to the AI
- The AI can determine parameter values automatically based on the file iteration context
Option B: Add as Tool Step on Canvas
- Add a Tool Action step to your canvas
- Select one of the supported tools
- Configure parameters to either:
- Let AI determine the values (system will use the automatically populated variables)
Step 4: AI Can Determine Values Automatically
The Magic: During execution, for each file in the datasource:-
System populates input variables:
-
AI uses these variables to call tools:
-
Process repeats for next file:
